#include "processor.hpp"

#include "protocol_all.hpp"

using namespace protocol;

IMPL_LOGGER(Processor, logger);

template <>
void Processor::process(Connection & conn, const ProtocolExampleReq & protocol)
{
	/// do nothing 
}

void Processor::process_message(Connection & conn, void * data)
{
	Protocol * protocol = (Protocol*)data;

	LOG4CPLUS_TRACE(logger, protocol->to_string());

	uint32_t type = protocol->protocol_type();

#define USE_SWITCH

#define PROTOCOL_CMD(class, cmd0, cmd1, cmd1_value) \
	case MakeUint32_t<cmd0, cmd1>::value: \
	  {   \
		  process(conn, (*(class*)protocol)); \
		  \
		  break; \
	  }

#include "protocol_value.def"

#undef PROTOCOL_CMD

#undef USE_SWITCH

}

